package com.imufe.chemicalenterprisedangerwarning.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.imufe.chemicalenterprisedangerwarning.entity.po.UserRolePO;
import com.imufe.chemicalenterprisedangerwarning.entity.vo.RoleVO;
import com.imufe.chemicalenterprisedangerwarning.mapper.UserRoleMapper;
import com.imufe.chemicalenterprisedangerwarning.service.RoleService;
import com.imufe.chemicalenterprisedangerwarning.service.UserRoleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author BaiBan
 * @since 2022-10-11
 */
@Service
public class UserRoleServiceImpl extends ServiceImpl<UserRoleMapper, UserRolePO> implements UserRoleService {

    @Autowired
    UserRoleMapper mapper;

    @Override
    public Long getRoleIdByUserId(Long userId) {
        LambdaQueryWrapper<UserRolePO> qw = new LambdaQueryWrapper<>();
        qw.eq(UserRolePO::getUserId, userId);
        return mapper.selectOne(qw).getRoleId();
    }
}
